package com.magold.game.hud;

import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.opengl.font.IFont;
import org.andengine.opengl.font.Letter;

import android.opengl.GLES20;

public class Util {
	private Util() {}
	
	public static void initAlpha(AnimatedSprite pSprite, float pAlpha) {
		pSprite.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
		pSprite.setAlpha(pAlpha);
	}

	public static int getMaxWidthInDigits(IFont pFont) {
		int maxWidth = 0;
		for (int i = 0; i < 10; i++) {
			Letter l = pFont.getLetter((char) ('0' + i));
			if (maxWidth < l.mWidth) {
				maxWidth = l.mWidth;
			}
		}
		
		return maxWidth;
	}

}
